<template>
  <div class="app-container" v-loading="loading">
    <form-filter @on-filter="submitFilterForm" @clear="clear"/>
    <el-input  type="textarea" rows="25" style="margin:20px 0;"  :value="JSON.stringify(result,null,2)" />
  </div>
</template>
<script>
import { grid } from '@/build';
import { getThirdData } from '@/services/api/gameDataManage';
import FormFilter from './thirdRealTimeFilter.vue';

export default {
  name: 'thirdData',
  mixins: [grid],
  components: {
    FormFilter,
  },

  data() {
    return {
      result: {},
      loading: false,
      filters: {
        startTime: moment().format('YYYY-MM-DD 00:00:00'),
        endTime: moment().format('YYYY-MM-DD 23:59:59'),
        gamePlatform: undefined,
        type: undefined,
      },


    };
  },

  methods: {
    clear() {
      this.result = {};
    },
    submitFilterForm(formInline) {
      this.loading = true;
      this.filters.startTime = !formInline.time ? undefined : formInline.time[0];
      this.filters.endTime = !formInline.time ? undefined : formInline.time[1];
      this.filters = { ...this.filters, ...formInline };
      this.doGet({ action: 'getGrid' });
    },
  },
  mounted() {
    this.bindGet(getThirdData, 'result', {
      action: 'getGrid',
      sendingData: 'filters',
      callback: ([result, data]) => {
        this.result = data;
        this.loading = false;
      },

    });
  },
};
</script>
<style scope lang="scss">
  .mgtop{
    margin-top:30px;
  }
</style>
